package com.ve.clexer.tree;

import java.util.ArrayList;

public class Function extends RangeNode {


    public Variable.VariableType returnType;//返回值
    public boolean isStatic;//静态
    public ArrayList<Variable> parameters;//参数


    public Function(String name) {
        super(name);
        parameters = new ArrayList<>();
    }

    public Function() {
        parameters = new ArrayList<>();
    }


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(returnType.type).append(" ").append(name).append("(");
        int i = 0;
        for (Variable var : parameters) {
            sb.append(var);
            if (i != parameters.size() - 1) {
                sb.append(",");
            }
            i++;
        }
        sb.append(")");

        return sb.toString();
    }


}
